import request from '@/utils/request'

// 查询楼栋房间列表
export function listRoom(query) {
  return request({
    url: '/basedata/room/list',
    method: 'get',
    params: query
  })
}

// 查询楼栋房间详细
export function getRoom(ID) {
  return request({
    url: '/basedata/room/' + ID,
    method: 'get'
  })
}

// 新增楼栋房间
export function addRoom(data) {
  return request({
    url: '/basedata/room',
    method: 'post',
    data: data
  })
}

// 修改楼栋房间
export function updateRoom(data) {
  return request({
    url: '/basedata/room',
    method: 'put',
    data: data
  })
}

// 删除楼栋房间
export function delRoom(ID) {
  return request({
    url: '/basedata/room/' + ID,
    method: 'delete'
  })
}
//房间绑定设备
export function bindterminal(data) {
  return request({
    url: '/basedata/room/roomBoundTerminal',
    method: 'put',
    data: data
  })
}

//房间绑定用户
export function binduser(data) {
  return request({
    url: '/basedata/room/roomBoundUser',
    method: 'put',
    data: data
  })
}
//换表
export function replaceterminal(data) {
  return request({
    url: '/basedata/room/changeTerminalXb',
    method: 'put',
    data: data
  })
}

//过户
export function replaceuser(data) {
  return request({
    url: '/basedata/room/changeUser',
    method: 'put',
    data: data
  })
}

// 根据楼栋查房间
export function getldroom(ID) {
  return request({
    url: '/basedata/room/listByLd/?ldId=' + ID,
    method: 'get'
  })
}

export function getAreald(ID){
  return request({
    url: '/basedata/loudong/optionselect?treeAreaCode=' + ID,
    method: 'get'
  })
}
